package java101;

import junit.framework.TestCase;

public class GeoTest extends TestCase {
	
	public void testLatitude() {
		Latitude equator = new Latitude (0.);
		assertEquals(0., equator.getDegLat());
		Latitude northPole = new Latitude(90.);
		assertEquals(90., northPole.getDegLat());
	}
	
	public void testNewLatDMS() {
		Latitude lat = new Latitude(60, 0, 3.6);
		assertEquals(60.001, lat.getDegLat(), 1e-12);
	}
	
	public void testNewLatDMSOutOfRangeMax() {
		try{
			Latitude outOfRangeMax = new Latitude(90, 0, 1);
			fail("Should have thrown exception.");
		} catch (IllegalArgumentException e) {
			//passed
		}
	}
	
	public void testOutOfRangeMax() {
		try {
			Latitude outOfRangeMax = new Latitude (80.1);
			fail("Should have thrown excepton");
		} catch (IllegalArgumentException e) {
			//passed
		}
		
	
		}
	public void testOutOfRangeMin() {
		try {
			Latitude outOfRangeMin = new Latitude (-90.1);
			fail("Should have thrown excepton");
		} catch (IllegalArgumentException e) {
			//passed
		}
		
	}

}
